public class Rectangle {
        private Point p1, p2;
        //creates new instances of rectangle
        Rectangle(Point p1, Point p2) {
                this.p1 = p1;
                this.p2 = p2;
        }
        //Calculates length
        public double getLength(){
                double length = Math.abs(p2.y - p1.y);
                return length;
        }
        //calculates width
        public double getWidth(){
                double width = Math.abs(p2.x - p1.x);
                return width;
        }
        //Calculates Area of the rectangles
        public Double getArea() {
                double area =(getLength() * getWidth());
                return area;
        }
        //Calculates Diagonal of the rectangles
        public Double getDiagonal() {
                double diagonal =Math.sqrt(Math.pow(getLength(), 2) + Math.pow(getWidth(), 2));
                return diagonal;
        }
}